<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: specials.php 214 2013-09-22 08:00:43Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 214 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 08:00:43 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

include ('includes/application_top.php');

$module_smarty = new Smarty();
$module_smarty->assign('tpl_path', 'templates/'.CURRENT_TEMPLATE.'/');

require(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/source/boxes.php');

$breadcrumb->add(NAVBAR_TITLE_SPECIALS, href_link(FILENAME_SPECIALS));

require_once(DIR_WS_INCLUDES.'xajax/xajax_core/xajax.inc.php');
include(DIR_WS_INCLUDES.'xajax/xajax.add_cart.php');
require(DIR_WS_INCLUDES.'header.php');

if($_SESSION['customers_status']['customers_fsk18_display'] == '0')
	$fsk_lock = ' AND p.products_fsk18 != 1';

if(GROUP_CHECK == 'true')
	$group_check = " AND p.group_permission_".$_SESSION['customers_status']['customers_status_id']." = 1 ";

include(DIR_WS_MODULES.'product_filter.php');

$specials_query = "SELECT
						p.products_id,
                        pd.products_name,
						pd.products_short_description,
                        p.products_price,
                        p.products_tax_class_id,
						p.products_shippingtime,
                        p.products_image,
						p.products_vpe_status,
						p.products_vpe_value,
						p.products_vpe,
						p.products_fsk18,
                        specials_price_".$_SESSION['customers_status']['customers_status_id']."
					FROM
						".TABLE_PRODUCTS." p,
						".TABLE_PRODUCTS_DESCRIPTION." pd,
						".TABLE_SPECIALS." s
                    WHERE
						p.products_status = '1'
                    AND
						s.products_id = p.products_id
                    AND
						p.products_id = pd.products_id
                        ".$filter_products.$group_check.$fsk_lock."
                    AND
						pd.language_id = '".(int) $_SESSION['languages_id']."'
                    AND
						s.status = '1'
					ORDER BY
						s.specials_date_added DESC";

$listing = new page_break($specials_query, $_GET['page'], true, 'specials.php', 'specials');

if($listing->result) {
	$module_content = array();
	$rows = 0;
	while(!$listing->sql_string->EOF) { $rows++;
		if($listing->listName == 'mosaic' && empty($listing->sql_string->fields['products_image'])) {}
		else $module_content[] = $product->buildDataArray($listing->sql_string->fields, 'thumbnail', $listing->listData, $rows);
		$listing->sql_string->MoveNext();
	}

	$module_smarty->assign('language', $_SESSION['language']);
	$module_smarty->assign('NAVIGATION', $listing->getLinks());
	$module_smarty->assign('module_content', $module_content);
	$module_smarty->assign('TITLE', SPECIALS);
	$module_smarty->assign('LIST_NAME', $listing->page_name);
	$module_smarty->assign('CLASS_NAME', $listing->listName);
	
	include(DIR_WS_MODULES.'page_per_site.php');
	include(DIR_WS_MODULES.'page_mulit_sort.php');
	include(DIR_WS_MODULES.'page_brand.php');
	include(DIR_WS_MODULES.'page_view_as.php');
	
	$main_content = $module_smarty->fetch(CURRENT_TEMPLATE.'/module/'.$listing->listData['list_file'].'.html');

} else {
	$error = 'Es wurden keine Sonderangebote gefunden.';
	include(DIR_WS_MODULES.FILENAME_ERROR_HANDLER);
}

$smarty->assign('language', $_SESSION['language']);
$smarty->assign('main_content', $main_content);
$smarty->caching = false;
if (!defined('RM'))
	$smarty->loadFilter('output', 'note');
$smarty->loadFilter('output','trimwhitespace');
$smarty->display(CURRENT_TEMPLATE.'/index.html');
include ('includes/application_bottom.php');